package org.noote.libs.robot.object3d;

import javax.microedition.khronos.opengles.GL10;

import org.noote.libs.robot.Robot_Skeleton;
import org.noote.libs.skeleton.Bone;
import org.noote.libs.sogle.Object3D;

public class Robot_Skeleton3D extends Object3D {
	
	int _iDrawType=0;
	public static final int _DRAW_WIRED=0x01, _DRAW_BOX=0x02, DRAW_MESH=0x04;
	
	protected Robot_Skeleton _robot = null;
	
	public Robot_Skeleton3D(Robot_Skeleton robot) {
		super();
		_robot = robot;
	}
	
	public Robot_Bone3D newBone()
	{
		Robot_Bone3D new_bone = new Robot_Bone3D();
		_robot.addBone(new_bone);
		return new_bone;
	}

	public void update()
	{
		_robot.update();
	}
	
	public void drawMode(int iDrawType)
	{
		_iDrawType = iDrawType;
	}

	@Override
	protected void _drawElement(GL10 gl)
	{
		for(Bone bone : _robot.getBones())
		{
			if(bone instanceof Robot_Bone3D)
			{
				((Robot_Bone3D)bone).draw(gl, _iDrawType);
			}
		}
	}
}
